 <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ page import="javax.sql.*,java.sql.*, java.io.PrintWriter" %>
 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

</head>
<body>
<%
    String fixId = request.getParameter("fixId");
    String action = request.getParameter("action");

    if ("resolve".equals(action)) {
        Connection con = null;
        PreparedStatement pst = null;
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/javaweb?serverTimezone=UTC", "root", "aa5678989");
            String updateQuery = "UPDATE Fix SET Fixed = 1 WHERE Fix_id = ?";
            pst = con.prepareStatement(updateQuery);
            pst.setString(1, fixId);
            pst.executeUpdate();
            response.sendRedirect("WyFix.jsp"); // 重定向回原始页面
        } catch (Exception e) {
            e.printStackTrace(new PrintWriter(out));
        } finally {
            try { if (pst != null) pst.close(); } catch (SQLException e) { e.printStackTrace(new PrintWriter(out)); }
            try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(new PrintWriter(out)); }
        }
    }
%>

</body>

</html>

 
